import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ActivityOrderVO, ActivityOrderForm, ActivityOrderQuery } from '@/api/system/activityOrder/types';

/**
 * 查询活动订单列表
 * @param query
 * @returns {*}
 */

export const listActivityOrder = (query?: ActivityOrderQuery): AxiosPromise<ActivityOrderVO[]> => {
  return request({
    url: '/system/activityOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询活动订单详细
 * @param id
 */
export const getActivityOrder = (id: string | number): AxiosPromise<ActivityOrderVO> => {
  return request({
    url: '/system/activityOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增活动订单
 * @param data
 */
export const addActivityOrder = (data: ActivityOrderForm) => {
  return request({
    url: '/system/activityOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改活动订单
 * @param data
 */
export const updateActivityOrder = (data: ActivityOrderForm) => {
  return request({
    url: '/system/activityOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除活动订单
 * @param id
 */
export const delActivityOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/activityOrder/' + id,
    method: 'delete'
  });
};
